home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
win
/
general
/
cdbw.exe
/
DBMGR.H
< prev
next >
Wrap
Text File
|
1991-10-29
|
14KB
|
335 lines
/*
* dbmgr.h
*
* This file contains structures, macros and #defines for
* the database layout.
*
* Copyright (C) 1989, 1990, 1991 by Daytris. All rights reserved.
*/
/* DBTALK prototypes */
DWORD FAR PASCAL DbClose( HANDLE);
DWORD FAR PASCAL DbFileGetLockStatus( HANDLE, LPSTR, LPBYTE);
DWORD FAR PASCAL DbFileLock( HANDLE, LPSTR);
DWORD FAR PASCAL DbFileUnlock( HANDLE, LPSTR);
DWORD FAR PASCAL DbFlush( HANDLE);
DWORD FAR PASCAL DbGetNbrClients( HANDLE, LPWORD);
DWORD FAR PASCAL DbOpen( HWND, LPSTR, LPSTR, BOOL, LPHANDLE);
DWORD FAR PASCAL DbRecordAdd( HANDLE, LPSTR, HANDLE);
DWORD FAR PASCAL DbRecordDelete( HANDLE, LPSTR);
DWORD FAR PASCAL DbRecordFindByKey( HANDLE, LPSTR, LPSTR, HANDLE);
DWORD FAR PASCAL DbRecordFindFirst( HANDLE, LPSTR, LPSTR);
DWORD FAR PASCAL DbRecordFindLast( HANDLE, LPSTR, LPSTR);
DWORD FAR PASCAL DbRecordFindNext( HANDLE, LPSTR, LPSTR);
DWORD FAR PASCAL DbRecordFindPrev( HANDLE, LPSTR, LPSTR);
DWORD FAR PASCAL DbRecordGetByKey( HANDLE, LPSTR, LPSTR, HANDLE, HANDLE);
DWORD FAR PASCAL DbRecordGetCurrency( HANDLE, LPSTR, HANDLE);
DWORD FAR PASCAL DbRecordGetCurrent( HANDLE, LPSTR, HANDLE);
DWORD FAR PASCAL DbRecordGetFirst( HANDLE, LPSTR, LPSTR, HANDLE);
DWORD FAR PASCAL DbRecordGetLast( HANDLE, LPSTR, LPSTR, HANDLE);
DWORD FAR PASCAL DbRecordGetNext( HANDLE, LPSTR, LPSTR, HANDLE);
DWORD FAR PASCAL DbRecordGetPrev( HANDLE, LPSTR, LPSTR, HANDLE);
DWORD FAR PASCAL DbRecordUpdate( HANDLE, LPSTR, HANDLE);
DWORD FAR PASCAL DbRecordUpdCurrency( HANDLE, LPSTR, HANDLE);
DWORD FAR PASCAL DbSetAdd( HANDLE, LPSTR, LPSTR);
DWORD FAR PASCAL DbSetDelete( HANDLE, LPSTR, LPSTR);
DWORD FAR PASCAL DbSetFindFirst( HANDLE, LPSTR, LPSTR);
DWORD FAR PASCAL DbSetFindLast( HANDLE, LPSTR, LPSTR);
DWORD FAR PASCAL DbSetFindNext( HANDLE, LPSTR, LPSTR);
DWORD FAR PASCAL DbSetFindPrev( HANDLE, LPSTR, LPSTR);
DWORD FAR PASCAL DbSetGetFirst( HANDLE, LPSTR, LPSTR, HANDLE);
DWORD FAR PASCAL DbSetGetLast( HANDLE, LPSTR, LPSTR, HANDLE);
DWORD FAR PASCAL DbSetGetNext( HANDLE, LPSTR, LPSTR, HANDLE);
DWORD FAR PASCAL DbSetGetOwner( HANDLE, LPSTR, LPSTR, HANDLE);
DWORD FAR PASCAL DbSetGetPrev( HANDLE, LPSTR, LPSTR, HANDLE);
DWORD FAR PASCAL XDbRecordAdd( HANDLE, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbRecordFindByKey( HANDLE, LPSTR, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbRecordGetByKey( HANDLE, LPSTR, LPSTR, LPVOID, short, LPVOID, short);
DWORD FAR PASCAL XDbRecordGetCurrency( HANDLE, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbRecordGetCurrent( HANDLE, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbRecordGetFirst( HANDLE, LPSTR, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbRecordGetLast( HANDLE, LPSTR, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbRecordGetNext( HANDLE, LPSTR, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbRecordGetPrev( HANDLE, LPSTR, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbRecordUpdate( HANDLE, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbRecordUpdCurrency( HANDLE, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbSetGetFirst( HANDLE, LPSTR, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbSetGetLast( HANDLE, LPSTR, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbSetGetNext( HANDLE, LPSTR, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbSetGetOwner( HANDLE, LPSTR, LPSTR, LPVOID, short);
DWORD FAR PASCAL XDbSetGetPrev( HANDLE, LPSTR, LPSTR, LPVOID, short);
/* Error defines */
#define E_TESTDRIVE -5
#define E_WINALLOC -4
#define E_LOADMODULE -3
#define E_INVALIDCASE -2
#define E_DOS -1
#define E_NORECNAME 1
#define E_NOFLDNAME 2
#define E_INVALIDSET 3
#define E_NOTAKEY 4
#define E_NOTFOUND 5
#define E_NEXTGUESS 6
#define E_NOCURRENT 7
#define E_NONEXT 8
#define E_NOPREV 9
#define E_NOMEMBER 10
#define E_NOOWNER 11
#define E_FILELOCKED 12
#define E_HASMEMBER 13
#define E_HASOWNER 14
/************************************************
* CDB Internals
************************************************/
/* DBCALL.C prototypes */
DWORD DbCall( HANDLE, WORD, ...);
DWORD XDbCall( HANDLE, WORD, ...);
/* CDB Server Name */
#define CDB_SERVER "dbserver.exe"
#define CDB_SERVER_CLASS "CDBServerClass"
/* Structure passed between client and server */
typedef struct sCDBTALK
{
WORD wCall;
char szName1[67];
char szName2[32];
HANDLE hData1;
HANDLE hData2;
} CDBTALK;
/* Type definitions */
typedef char CHAR;
typedef unsigned char UCHAR;
typedef short INT;
typedef unsigned short UINT;
typedef unsigned long ULONG;
/* Define BORLANDC_DBSERVER when recompiling the dbserver.exe with */
/* Borland C++. Borland C++ does not like the ... declaration. */
#ifndef BORLANDC_DBSERVER
INT cdb( INT, ...);
#endif
/* Database call defines */
#define D_OPEN 0
#define D_CLOSE 1
#define D_FLUSH 2
#define D_GET_CURRENCY 3
#define D_UPDATE_CURRENCY 4
#define D_FIND_FIRST_RECORD 5
#define D_FIND_LAST_RECORD 6
#define D_FIND_NEXT_RECORD 7
#define D_FIND_PREV_RECORD 8
#define D_FIND_RECORD_BY_KEY 9
#define D_GET_FIRST_RECORD 10
#define D_GET_LAST_RECORD 11
#define D_GET_NEXT_RECORD 12
#define D_GET_PREV_RECORD 13
#define D_GET_RECORD_BY_KEY 14
#define D_GET_CURRENT_RECORD 15
#define D_ADD_RECORD 16
#define D_UPDATE_RECORD 17
#define D_DELETE_RECORD 18
#define D_FIND_FIRST_SET 19
#define D_FIND_LAST_SET 20
#define D_FIND_NEXT_SET 21
#define D_FIND_PREV_SET 22
#define D_GET_FIRST_SET 23
#define D_GET_LAST_SET 24
#define D_GET_NEXT_SET 25
#define D_GET_PREV_SET 26
#define D_GET_SET_OWNER 27
#define D_ADD_SET 28
#define D_DELETE_SET 29
#define D_LOCK_FILE 30
#define D_UNLOCK_FILE 31
#define D_GET_LOCK_STATUS 32
#define D_OPEN_DUPLICATE 33
#define D_GET_NBR_CLIENTS 34
#define NBRHANDLES 8 /* Maximum number of file handles */
#define MAXKEY 8 /* Maximum # of keys per key record */
#define KEYPAGESIZE 512 /* Key page buffer size */
#define NBRPAGES 16 /* Number of key page buffers */
#define DATAPAGESIZE 2048 /* Data page buffer size */
#define DATASLOTSIZE 1024 /* Data file slot buffer size */
/* Testdrive version defines */
#define TESTDRIVE_MAX_RECORDS 50L
/* Field index structure defines */
#define KEY_FIELD 0x01
#define SET_KEY_FIELD 0x01
/* Handle index structure defines */
#define FILE_MODIFIED 0x01
/* Key file index structure defines */
#define PAGE_FULL 0x01
/* Page index structure defines */
#define PAGE_DIRTY 0x01
/* DataBase structures and unions */
union type
{
CHAR charval;
INT intval;
LONG longval;
float floatval;
double doubleval;
CHAR *ptrval;
UCHAR ucharval;
UINT uintval;
ULONG ulongval;
};
struct dbheader /* 128 bytes */
{
CHAR title[96]; /* DBD title */
UINT totrecs; /* Total number of records */
UINT totowns; /* Total number of owners */
UINT totmems; /* Total number of members */
UINT totflds; /* Total number of fields */
CHAR prefix[6]; /* File prefix description */
CHAR filler[18];
};
struct record_index /* 46 bytes */
{
UINT firstown; /* First owner */
UINT nbrowns; /* Number of owners */
UI